---
title: Default Style
---

We provide two levels of default styles:
1. The default style of the worksheet
2. The default style of the column or row

Both can be set through the [`IWorksheetData`](https://reference.univer.ai/en-US/interfaces/IWorksheetData) interface or the Facade API.

## Configuration

By default, the column style takes precedence over the row style. You can change this behavior by setting `isRowStylePrecedeColumnStyle` during registration.

```typescript
univer.registerPlugin(UniverSheetsPlugin, {
  isRowStylePrecedeColumnStyle: true,
})
```

## Set Default Style

There are two ways to set the default style of a worksheet:

1. Through the [`IWorksheetData`](https://reference.univer.ai/en-US/interfaces/IWorksheetData) interface

```typescript
interface IWorksheetData {
  // other
  /**
   * @property {Nullable<IStyleData>} [defaultStyle] - Default style data of Worksheet.
   */
  defaultStyle?: Nullable<IStyleData>
}

interface IRowData {
  // other
  /**
   * style data
   */
  s?: Nullable<IStyleData>
}

interface IColumnData {
  // other
  /**
   * style data
   */
  s?: Nullable<IStyleData>
}
```

2. Set through the Facade API

```typescript
const fworkbook = univerAPI.getActiveWorkbook()
const fworksheet = fworkbook.getActiveSheet()
const defaultStyle = {
  bg: {
    rgb: 'red',
  },
}
const defaultColumnStyle = {
  bg: {
    rgb: 'blue',
  },
}
const defaultRowStyle = {
  bg: {
    rgb: 'green',
  },
}

// set default style
fworksheet.setDefaultStyle(defaultStyle)
// set column D default style
fworksheet.setColumnDefaultStyle(3, defaultColumnStyle)
// reset column D the default style
fworksheet.setColumnDefaultStyle(3, undefined)

// set row default style
fworksheet.setRowDefaultStyle(1, defaultRowStyle)
```
